﻿<?php ?>
<?php
	include('lib_db.php');
	
	//buoc 1 get input
	//co 1 tham so ten la q
	$id = isset($_GET['id']) ? $_GET['id'] * 1 : '';
	if ($id < 0) return 0;
	//echo $q;exit();
	//buoc 2 tao sql
	$sql = "select * from book where idBook = $id";
	//echo $sql;exit();
	//buoc 3 thuc thi
	$chi_tiet = select_list($sql);
	//print_r($datas);exit();
	//buoc 4 output
	//Create for me
?>

		<div id ="wrapper">
			<div id ="header"><?php include("header.php");?></div><!--end header-->		
			<div id ="content">
				<div class="content-header"><?php include ("header-content.php")?></div> <!--end content-header-->
				
						<div class="clear-both"></div>			
				<div class="content-menu">
					<div class ="content-menu-left "><?php include ("content-menu-left.php")?></div>	<!--end content-menu-left -->					
					
					<!------ bắt đầu phần content-menu-center ----->
					<?php if($chi_tiet) foreach ($chi_tiet as $data){?>
					<div class="content-menu-center">
						<div class="breadcrumb">
							<a title="trở về Trang chủ" href="/">Trang chủ</a>
							<span class="navigation-pipe">></span>
							<span class="navigation_end">
								<a href="http://vbook.vn/193-moi-ngay-1-cuon-sach"> Mỗi ngày 1 cuốn sách</a>
							</span>
							<span class="navigation-pipe">></span>
							<span class="navigation_product"><?php echo $data['Name']?></span>
						</div><!-- end breadcrumb-->
						<div id="primary_block" class="clearfix padT10">
							<div id="pb-right-column">
									<div id="image-block">
										<img id="bigpic" alt="" title=" <?php echo $data['Name']?>" src="img1/<?php echo $data['ImgCover']?>">
									</div>
							</div>
							<div id="Basic_infor">
							<div id="infor11">
								<table cellspacing="0">
								<tbody>
									<tr>
										<td>Tác phẩm</td>
										<td><strong><?php echo $data['Name']?></strong></td>
									</tr>	
									<tr>
										<td>Tác giả</td>
										<td><strong><span class="red"><i><?php echo $data['Author']?></i></span></strong></td>
									</tr>		
									<tr>
										<td>NXB</td>
										<td><?php echo $data['Publisher']?></td>
									</tr>					
									<tr>
										<td>Giá bìa</td>
										<td><span class="our_price_display"><span id="our_price_display"><?php echo $data['SalePrice']?>đ</span></span></td>
									</tr>
									<tr>
										<td><strong><span class="red"><h5>GÍA KHUYẾN MÃI</h5></span></strong></td>
										<td><?php echo $data['CoverPrice']?></br>
										<span class="red"><p id="reduction_percent"><h6>(giá giảm<span id="reduction_percent_display"><?php echo $data['SaleOff']?></span>%)</h6></p></span></td>
									</tr>
								</tbody>
								</table>
								</div>
								<div id="infor12">
								<p id="add_to_cart" class="buttons_bottom_block">
														<input class="exclusive" type="submit" value="Đặt mua" name="Submit">
								</div>
							</div>
						</div><!--end primarybox-->
								<ul class="tabs">
										<li class="tab1">Thông tin sách</li>
										<li class="tab2">Thông tin chi tiết</li>
								</ul>
							<div class="boxInfodetail">
								<form id="buy_block" method="post" action="/cart.php">
									<ul class="tabs-content">
										<li class="tab1">
											<strong><h3><b class="red"><?php echo $data['Name']?></b></h3></strong></br>
											<h5><img src="img/none.jpg"/><u>Sách của nhà văn <?php echo $data['Author']?></u></h5></br>
											<span class="descb-color"><?php echo $data['Description']?></span>
										</li>
										<li class="tab2">
											<p class="hidden">
												<input type="hidden" value="64f9bae094ee0495eec5ddc984ea879b" name="token">
												<input id="product_page_product_id" type="hidden" value="31749" name="id_product">
												<input type="hidden" value="1" name="add">
												<input id="idCombination" type="hidden" value="" name="id_product_attribute">
											</p>
											AMNBVEDFHHVHGV
										</li>
									</ul>
								</form><!--end form detail-->
									
									
							</div><!-- end boxInfodetail  -->
						
						<div class="rebook">
							<span class="sach-dac-biet">Tác phẩm cùng Tác giả</span>
								<?php 
								$tg=$data['Author'];
								$sql1=("SELECT * FROM book WHERE Author='$tg'  && idBook!=$id");
								$Sach_listDB = select_list($sql1);
								//SELECT the Books which have related with this book, by Author, Type (the loai), same year to eye.... 
								if($Sach_listDB) foreach ($Sach_listDB as $re_Book){?>
									<div id="rebook2">
										<a href="<?php echo $re_Book["Link"]?>?id=<?php echo $re_Book["idBook"]?>">
											<div>
												<img height="170px" width="129px" src="img1/<?php echo $re_Book["ImgCover"];?>"></br></br>
											</div>
											<ul><?php echo $re_Book['Name']?></ul>
										</a>
										<u><i class="red">Giá:</i></u><?php echo $re_Book['SalePrice']?>đ
									</div>
								<?php }
								//else search under parameter= Type
								//if don't have anybook, show "None book related!"
								?>	
						</div><!--end related books-->
					<?php } ?>
						

					</div> <!--end content-menu-center-->
					<div class ="content-menu-right"><?php include ("content-menu-right.php")?></div> <!--end content-menu-right-->
								
				</div> <!--end content-menu-->
			
			</div> <!--end content-->
			<div id ="footer"><?php include("footer.php");?></div><!--end footer-->
		</div><!--end wapper-->
		<script src="js/jquery-1.4.1.js" type="text/javascript"></script>	
		<script type="text/javascript">
			$(document).ready( function () {
				$('.tab1').addClass('active');
				$('.tab2').click(function(){
					$('.tab1').removeClass('active');
					$('.tab2').addClass('active');
				});
				$('.tab1').click(function(){
						$('.tab2').removeClass('active');
						$('.tab1').addClass('active');
				});
			});
		</script>